package d2_UDP;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

public class Cilent {
    public static void main(String[] args) throws Exception {
        //创建客户端对象
        DatagramSocket socket = new DatagramSocket();
        //创建数据包
        byte[] buf = "乌拉圭的".getBytes();
        DatagramPacket packet = new DatagramPacket(buf, buf.length,InetAddress.getLocalHost(),7894);
        //发送数据
        socket.send(packet);
        socket.close();//释放资源
    }
}
